/**
 *
 */
package santeclair.connexion.service.technique.echanges.impl;

import org.springframework.stereotype.Service;

import santeclair.connexion.domaine.parametrage.ServiceCalculPartenaire;
import santeclair.connexion.domaine.parametrage.ServicePartenaire;
import santeclair.connexion.domaine.technique.RetourBean;
import santeclair.connexion.service.technique.echanges.exception.ConnexionServiceException;

/**
 * @author jfourmond
 * 
 */
@Service("connexionMockService")
public class ConnexionMockServiceImpl extends ConnexionLocaleServiceImpl {

    /* 208 ou 209. */
    public static String typeDemande;

    /** {@inheritDoc} */
    @Override
    public RetourBean appelerService(ServicePartenaire servicePartenaire,
                    String trame) throws ConnexionServiceException {

        if (servicePartenaire instanceof ServiceCalculPartenaire) {

            String trameRetour = null;
            if ("208".equals(typeDemande)) {
                trameRetour = "75049023000000316765                      14081969BLANDINE                        E01                                                                                                                                                                                                                                                          SPREV                            01                                                  0003300000000572000000000000000000032428000                                       208                                                                                     0000000000000000000000000000000000000000000                                       208                                                                                     0000000000000000000000000000000000000000000                                       208                                                                                     0000000000000000000000000000000000000000000                                       208                                                                                     0000000000000000000000000000000000000000000                                       208                                                                                     0000000000000000000000000000000000000000000                                       208                                                                                     0000000000000000000000000000000000000000000                                       208                                                                                     0000000000000000000000000000000000000000000                                       208                                                                                     0000000000000000000000000000000000000000000                                       208                                                                                     0000000000000000000000000000000000000000000                                       208";
            } else if ("209".equals(typeDemande)) {
                trameRetour = "02420008000911526                         14051952HENRI                           E01                                                                                                                                                                                                                                                          V101 NGO5           NGO5           01                                                  0000320000000137000000000000306300000000001                                     209V101 NGO5           NGO5           01                                                  0000320000000137000000000000306300000000001                                     209M101 NGO5           NGO5           01                                                  0001550000000170000000000001533000000000001                                     209                                                                                       0000000000000000000000000000000000000000000                                     209                                                                                       0000000000000000000000000000000000000000000                                     209                                                                                       0000000000000000000000000000000000000000000                                     209                                                                                       0000000000000000000000000000000000000000000                                     209                                                                                       0000000000000000000000000000000000000000000                                     209                                                                                       0000000000000000000000000000000000000000000                                     209                                                                                       0000000000000000000000000000000000000000000                                     209";
            }
            RetourBean retourBean = new RetourBean();
            retourBean.setTrameExtraite(trameRetour);
            return retourBean;

        } else {
            return super.appelerService(servicePartenaire, trame);
        }

    }

}
